package com.lagou.repository;

import com.lagou.pojo.Article;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface ArticleRepository extends JpaRepository<Article,Integer> {


  /**
   * 根据ID更新文章内容
   * @param content
   * @param id
   * @return
   */
  @Transactional
  @Modifying
  @Query("update t_article set content = ?1 where id = ?2")
  int update(String content, Integer id);

}
